import request from "../utils/service";

/**
 * 注册接口
 * @author Lijian
 * @param {string} payload.tel 手机号
 * @param {string} payload.password 密码
 * @returns {object} 注册是否成功
 */
export function user_dofinishregister(payload = {}) {
  return request.post("/user/dofinishregister", payload);
}

/**
 * 发送短信验证码
 * @author Lijian
 * @param {string} payload.tel 手机号
 * @returns {object} 发送验证码
 */
export function user_dosendmsgcode(payload = {}) {
  return request.post("/user/dosendmsgcode", payload);
}

/**
 * 验证手机号码是否被注册过

 * @author Lijian
 * @param {string} tel 手机号
 * @returns {object} 是否注册过
 */
export function user_docheckphone(payload = {}) {
  return request.post("/user/docheckphone", payload);
}

/**
 * 验证验证码

 * @author Lijian
 * @param {string} tel 手机号
 * @param {string} telcode 验证码
 * @returns {object} 验证验证码
 */
export function user_docheckcode(payload = {}) {
    return request.post("/user/docheckcode", payload);
  }

/**
 * 登陆

 * @author Lijian
 * @param {string} loginname 手机号
 * @param {string} password 密码
 * @returns {object} { code: '10010',
   message: '该用户不存在'}{
   code: '10011',
   message: '密码错误'
 }
  {
   code: '200',
   message: '登录成功',
   data: {
     token,
     userid
   }
 }
 */
export function user_login(payload = {}) {
  return request.post("/user/login", payload);
}
/**
 * 查询用户信息
 * @author Lijian
 * @param {string} userid 用户ID
 * @param {string} token 需要携带token
 * @returns {object} 返回用户信息
 */

export function user_info(payload={}){
  return request.get("/user/info",{params:payload})
}
